require "claide"
require "pathname"
require "colored2"

module Imp2pod
  module UserInterface
    class << self
      include Config::Mixin

      def notice(message)
        puts("#{message}".ansi.green)
      end

      def error(message)
        puts("\n[!!!] #{message}".ansi.red)
      end

      def warning(message)
        puts("\n[!] #{message}".ansi.yellow)
      end

      def puts(message = "")
        return if config.silent?
        begin
          STDOUT.puts(message)
        rescue Errno::EPIPE
          exit 0
        end
      end
    end
  end

  UI = UserInterface
end
